package com.yimu.lib.util;

import android.os.Handler;
import android.os.Looper;
/**
 * 描述：UIHandler工具类
 * 创建者：  Churck
 * 创建时间：16/6/8
 * 修改者： Churck
 * 修改时间：16/6/8
 * 版 本：v1.0
 */
public final class UIHandler {
	private static final Handler handler = new Handler(Looper.getMainLooper());

	public static final Handler get() {
		return handler;
	}

	private UIHandler() {
	}

	public static boolean isUiThread() {
		return Looper.myLooper() == Looper.getMainLooper();
	}

	public static void runOnUiThread(Runnable r) {
		if (isUiThread()) {
			r.run();
		} else {
			handler.post(r);
		}
	}
}
